//
//  Comment.m
//  addActionForm
//
//  Created by user on 11.04.11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "Comment.h"

@implementation Comment
@synthesize isNew;
@synthesize changed;
@synthesize comments;

- (id) init{
	[super init];
	isNew = YES;
	changed = YES;
	comments = [[Comments alloc] init];
	[comments setVDateTime_Logged:[Library getCurrentTime]];
	[comments setVDescription:@"Add a description here..."];
	[comments setVOwner:-1];
	return self;
}


- (id) initWithComments : (Comments *) pcomments{
	[super init];
	comments = pcomments;
	return self;
}

- (id) initWithProject : (Project *) project{
	[self init];
	[comments setVIdProjects:[project getProjectId]];
	return self;
}
- (id) initWithAction : (Action *) action{
	[self init];
	[comments setVIdActions:[action getActionId]];
	return self;
}

- (id) initWithProblem : (Problem *) problem{
	[self init];
	[comments setVIdProblems:[problem getProblemId]];
	return self;	
}

- (NSString *) getDescription{
	return [comments vDescription];
}

- (NSString *) getOwner{
	return @"YOU";
	//return [comments vOwner];
}

- (double) getDate{
	return [comments vDateTime_Logged];
}

- (void) setDescription : (NSString *) description{
	[comments setVDescription: description];
	[comments setVRevision:[comments vRevision]+1];
}

- (NSString *) getInsertString{
	return [comments getInsertStringForSelf];
}

- (NSString *) getUpdateString{
	return [comments getUpdateStringForSelf];
}

@end
